<?php
    session_start();
    include '../../../controlador/php/conexion/Conexion.php';
    $con = new Conexion();
    
   /* $agef = "select DATEDIFF(day,GETDATE(),agefecha2)as dias
             from dnronagen
             where usuoid = ".$_SESSION['usuario']." and agestado = 1
            order by agestado asc";
    $resf = $con->query($agef);
    
    $ageoid = "";
    $dias = "";
    while($resf2 = mssql_fetch_array($resf)){
        $ageoid = $resf2['ageoid'];
        $dias = $resf2['dias'];
        if($dias < 0){
            $edi = "update dnronagen
                    set agestado = 4
                    where ageoid =".$ageoid;
            $con->query($edi);
        }
    }*/
    
    $age = "select agefecha1, agefecha2, agestado, servicio, GENDEPEND.GDPNOMBRE,usuoid,ageoid,GENDEPEND.OID
            from dnronagen inner join DGempres10..GENDEPEND on dnronagen.servicio = DGempres10..GENDEPEND.OID 
            where usuoid = ".$_SESSION['usuario']."
            order by agestado asc";
    $res = $con->query($age);
    
    
    while ($respu = mssql_fetch_array($res)){
        $respuesta[] = array_map(utf8_encode,$respu);
    }
    
    $con->cerrarConexion();
    print_r(json_encode($respuesta))
 
?>
